#ifndef WIDGET_H
#define WIDGET_H

#include <QWidget>
#include <QLabel>
#include <QVBoxLayout>
#include <QFileDialog>
#include <QLineEdit>
#include <QHBoxLayout>
#include <QTextEdit>

#include "mytoplabel.h"
#include "maincontrol.h"
#include "hostcomputermsg.h"


QT_BEGIN_NAMESPACE
namespace Ui { class Widget; }
QT_END_NAMESPACE

class Widget : public QWidget
{
    Q_OBJECT

public:
    Widget(QWidget *parent = nullptr);
    ~Widget();

protected:
    void resizeEvent(QResizeEvent *event) override;     // 重写 resizeEvent 事件处理函数

private:
    Ui::Widget *ui;

    QLabel *m_bgLabel;

    QVBoxLayout *m_mainLayout;

    MyTopLabel *m_myTopLabel;

    MainControl *m_saveObj;

    QPushButton *m_choiceFileButton;

    QLineEdit *m_fileSavePathLine;

    QPushButton *m_enterPathButton;

    QHBoxLayout *m_hLayout;

    QTextEdit *m_logShow;   //日志显示

    QLabel *m_ShowImgLabel;  //显示图像：测试使用

    HostComputerMsg *m_hostObject;   //和上位主机通讯对象

    ConfigFileClass m_cfg;  //ini存储对象

    HostMachine m_hostMachineStruct;    //存储结构体

    void createControl();   //创建控件

    QImage convert16BitGrayToQImage(const QByteArray &data, int width, int height); // 转换16bit灰度数据到QImage

public slots:
    void onShowImg(const QString ip, const quint16 port, const QByteArray arr);
};
#endif // WIDGET_H
